package tx.bj12320.dao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.junit.Test;

import cn.org.rapid_framework.test.context.TestMethodContext;

import static junit.framework.Assert.*;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bj12320.model.*;
import tx.bj12320.dao.*;
import tx.bj12320.service.*;
import tx.bj12320.vo.query.*;


public class TszbProcessInfoDaoTest extends BaseDaoTestCase{
	
	private TszbProcessInfoDao dao;
	
	@Autowired
	public void setTszbProcessInfoDao(TszbProcessInfoDao dao) {
		this.dao = dao;
	}

	@Override 
	protected String[] getDbUnitDataFiles() {
	    //通过 TestMethodContext.getMethodName() 可以得到当前正在运行的测试方法名称
		return new String[]{"classpath:testdata/common.xml","classpath:testdata/TszbProcessInfo.xml",
		                    "classpath:testdata/TszbProcessInfo_"+TestMethodContext.getMethodName()+".xml"};
	}
	
	//数据库单元测试前会开始事务，结束时会回滚事务，所以测试方法可以不用关心测试数据的删除
	@Test
	public void findPage() {

		TszbProcessInfoQuery query = newTszbProcessInfoQuery();
		Page page = dao.findPage(query);
		
		assertEquals(pageNumber,page.getThisPageNumber());
		assertEquals(pageSize,page.getPageSize());
		List resultList = (List)page.getResult();
		assertNotNull(resultList);
		
	}
	
	static int pageNumber = 1;
	static int pageSize = 10;	
	public static TszbProcessInfoQuery newTszbProcessInfoQuery() {
		TszbProcessInfoQuery query = new TszbProcessInfoQuery();
		query.setPageNumber(pageNumber);
		query.setPageSize(pageSize);
		query.setSortColumns(null);
		
	  	query.setOrgInfoId(new Long("1"));
	  	query.setWorkOrderType(new String("1"));
	  	query.setCallerName(new String("1"));
	  	query.setCallerNumber(new String("1"));
	  	query.setAge(new String("1"));
	  	query.setSex(new String("1"));
	  	query.setEduDegreee(new String("1"));
	  	query.setCellPhone(new String("1"));
	  	query.setArea(new String("1"));
	  	query.setOccupation(new String("1"));
	  	query.setContaceAddress(new String("1"));
	  	query.setPhone(new String("1"));
	  	query.setRelaUnitName(new String("1"));
	  	query.setRelaUnitCode(new String("1"));
	  	query.setRelaPerson(new String("1"));
	  	query.setLiaisonMan(new String("1"));
	  	query.setLiaisonCellPhone(new String("1"));
	  	query.setHappenAddress(new String("1"));
	  	query.setUnitType(new String("1"));
	  	query.setUnitTypeDdValue(new String("1"));
	  	query.setDepartment(new String("1"));
	  	query.setLiaisonPhone(new String("1"));
		query.setHappenTimeBegin(new Date(System.currentTimeMillis()));
		query.setHappenTimeEnd(new Date(System.currentTimeMillis()));
	  	query.setPonderance(new String("1"));
	  	query.setPonderanceDdValue(new String("1"));
	  	query.setWorkOrderSource(new String("1"));
	  	query.setWorkOrderSourceDdValue(new String("1"));
	  	query.setZoneName(new String("1"));
	  	query.setZoneDdValue(new String("1"));
	  	query.setIncomingCallContent(new String("1"));
	  	query.setIsBeWorkOrder(new String("1"));
	  	query.setTimeLimit(new Long("1"));
	  	query.setShoulliPerson(new String("1"));
		query.setShouliTimeBegin(new Date(System.currentTimeMillis()));
		query.setShouliTimeEnd(new Date(System.currentTimeMillis()));
	  	query.setChushenPerson(new String("1"));
	  	query.setShenhePerson(new String("1"));
	  	query.setReceiveDepartment(new String("1"));
	  	query.setReceivePerson(new String("1"));
		query.setReceiveTimeBegin(new Date(System.currentTimeMillis()));
		query.setReceiveTimeEnd(new Date(System.currentTimeMillis()));
	  	query.setLeaderToshowContent(new String("1"));
	  	query.setLeaderToshowSign(new String("1"));
		query.setLeaderToshowTimeBegin(new Date(System.currentTimeMillis()));
		query.setLeaderToshowTimeEnd(new Date(System.currentTimeMillis()));
	  	query.setDealDepartment(new String("1"));
	  	query.setDealPerson(new String("1"));
		query.setDealTimeBegin(new Date(System.currentTimeMillis()));
		query.setDealTimeEnd(new Date(System.currentTimeMillis()));
		query.setFeedbackRelaPersonTimeBegin(new Date(System.currentTimeMillis()));
		query.setFeedbackRelaPersonTimeEnd(new Date(System.currentTimeMillis()));
	  	query.setDealResult(new String("1"));
	  	query.setRelaPersonIdea(new String("1"));
	  	query.setThsiIsTrue(new String("1"));
	  	query.setIsImprove(new String("1"));
	  	query.setIsImproveText(new String("1"));
	  	query.setLeaderIssue(new String("1"));
	  	query.setLeaderIssueSign(new String("1"));
		query.setLeaderIssueTimeBegin(new Date(System.currentTimeMillis()));
		query.setLeaderIssueTimeEnd(new Date(System.currentTimeMillis()));
	  	query.setIsTrue(new String("1"));
	  	query.setWorkOrderSort(new String("1"));
	  	query.setWorkOrderSortDdValue(new String("1"));
	  	query.setResolveWay(new String("1"));
	  	query.setEventName(new String("1"));
	  	query.setEventHappenArea(new String("1"));
	  	query.setDetailAddress(new String("1"));
	  	query.setAffectPersonCount(new String("1"));
	  	query.setInvasionPersonCount(new String("1"));
	  	query.setDeathPersonCount(new String("1"));
	  	query.setProcInstId(new String("1"));
	  	query.setCurrActName(new String("1"));
		query.setProcStartTimeBegin(new Date(System.currentTimeMillis()));
		query.setProcStartTimeEnd(new Date(System.currentTimeMillis()));
	  	query.setIsProcEnd(new Long("1"));
		query.setProcEndTimeBegin(new Date(System.currentTimeMillis()));
		query.setProcEndTimeEnd(new Date(System.currentTimeMillis()));
	  	query.setCurrSysUserType(new String("1"));
	  	query.setIsReject(new Long("1"));
		query.setRejectTimeBegin(new Date(System.currentTimeMillis()));
		query.setRejectTimeEnd(new Date(System.currentTimeMillis()));
		return query;
	}
	
}
